package com.example.zhihu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.zhihu.entity.Token;
import com.example.zhihu.mapper.TokenMapper;
import com.example.zhihu.service.ITokenService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * token表 服务实现类
 * </p>
 *
 * @author author
 * @since 2022-05-06
 */
@Service
public class TokenServiceImpl extends ServiceImpl<TokenMapper, Token> implements ITokenService {

  @Override
  public Token getByUserId(Integer userId) {
    QueryWrapper<Token> queryWrapper = new QueryWrapper<>();
    queryWrapper.eq("user_id", userId);
    return this.getOne(queryWrapper);
  }
}
